// pages/collect/collect.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    collect: [],
    tabs: [
      {
        id: 0,
        value: "商品收藏",
        isActive: true
      },
      {
        id: 1,
        value: "品牌收藏",
        isActive: false
      },
      {
        id: 2,
        value: "店铺收藏",
        isActive: false
      },
      {
        id: 3,
        value: "浏览足迹",
        isActive: false
      }
    ]
  },
  //============事件监听==============================================
  handleTabsItemsClick(e) {
    let { tabs } = this.data;
    let { index } = e.detail;
    tabs.forEach((el, i) => {
      index == i ? el.isActive = true : el.isActive = false;
    });

    this.setData({
      tabs
    });
  },
  // =========== 生命周期 ====================================
  onShow(){
    const collect = wx.getStorageSync("collect")|| [];
    console.log(collect)
    this.setData({
      collect
    })
  }
})